
package cn.batch.daemon.service.impl;

import java.util.List;

import cn.batch.daemon.hibernate.bean.PbocErrorCust;
import cn.batch.daemon.hibernate.bean.PbocSummary;
import cn.batch.daemon.hibernate.dao.PbocErrorCustDao;
import cn.batch.daemon.hibernate.dao.PbocSummaryDao;
import cn.batch.daemon.service.IProcReportService;

/**
 * @author xihn
 * 保存人行征信数据
 *
 */
public class IProcReportServiceImpl implements IProcReportService {
	
	private PbocSummaryDao pbocSummaryDao;
	
	private PbocErrorCustDao pbocErrorCustDao;
	
	/* (non-Javadoc)
	 * @see cn.batch.daemon.service.IProcReportService#savePbocSummary(java.io.File)
	 */
	@Override
	public void savePbocSummary(PbocSummary pbocSummary) throws Exception {		
		//PbocSummary pbocSummary=BuildPbocSummary.bulidPbocSummary(xmlFile,batchDate);
		pbocSummaryDao.save(pbocSummary);
	}
	
	@Override
	public void saveErrorCustInfo(List<PbocErrorCust> peList) {
		for (int i = 0; i < peList.size(); i++) {
			PbocErrorCust pe = (PbocErrorCust)peList.get(i);
			pbocErrorCustDao.getHibernateTemplate().saveOrUpdate(pe);
		}
	}

	/**
	 * @param pbocSummaryDao the pbocSummaryDao to set
	 */
	public void setPbocSummaryDao(PbocSummaryDao pbocSummaryDao) {
		this.pbocSummaryDao = pbocSummaryDao;
	}

	/**
	 * @param pbocErrorCustDao the pbocErrorCustDao to set
	 */
	public void setPbocErrorCustDao(PbocErrorCustDao pbocErrorCustDao) {
		this.pbocErrorCustDao = pbocErrorCustDao;
	}

	@Override
	public List<PbocSummary> queryPbocSummary(PbocSummary py) {
		return pbocSummaryDao.queryByExample(py);
		
	}

	@Override
	public void deletePbocSummary(PbocSummary py) {
		pbocSummaryDao.delete(py);
	}

	
}
